package com.WISSC.controller;

import com.WISSC.util.file.FileUpload;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;

/**
 * 上传文件
 */
@Controller
@RequestMapping("/file")
@Api(value = "文件上传controller", tags = {"文件上传类"})
public class FileController {

    @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "文件上传")
    public Object upload(MultipartFile file)throws  Exception{

        Map map = new HashMap();
        map.put("code",0);
        map.put("msg","上传成功");
        map.put("data",FileUpload.fileUpload(file));

         return map;
    }

}
